package java0602;

import java.util.Scanner;

class IllegalScoreException extends Exception {
	
	public IllegalScoreException(String message){
		super(message);
	}

}
class IllegalNameException extends RuntimeException {
	
	public IllegalNameException(String a) {
		super(a);
	}
	
}
class Student{
	private String name;
	private int score;
	public String getName() {
		return name;
	}
	public void setName(String name)throws IllegalNameException {
		
		//String c=this.name.substring(0, 0);
		/*if(c.equals("0")||c.equals("1")||c.equals("2")||c.equals("3")||
				c.equals("4")||c.equals("5")||c.equals("6")||
				c.equals("7")||c.equals("8")||c.equals("9")){
			throw new IllegalNameException(this.name);
		}*/
		if(name.toCharArray()[0]>'0'&&name.toCharArray()[0]<'9')
			throw new IllegalNameException("the first char of name must not be digit, name="+name);
		this.name = name;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}
	public int addScore(int score)throws IllegalScoreException{
	
		if(score<0||score>100)
			throw new IllegalScoreException("score out of range, score="+score);
		return score;
	}
}
public class Java060504 {

	public static void main(String[] args) throws IllegalScoreException{
		// TODO Auto-generated method stub
		Scanner in=new Scanner(System.in);
		String n=in.next();
		while(n.equals("new")){
			Student s=new Student();
			try {
				s.setName(in.next());
				int score=in.nextInt();
				s.addScore(score);
				s.setScore(score);
				System.out.println(s.toString());
			} catch (IllegalNameException e1) {
				// TODO Auto-generated catch block
				System.out.println(e1.toString());
			} catch (IllegalScoreException e) {
				// TODO Auto-generated catch block
				System.out.println(e.toString());
			}
			n=in.next();	
		}
		in.close();
		System.out.println("scanner closed");
	}
	
}
